package com.clusterswisdom.horn.api.tmall.action.trade;

import com.alibaba.fastjson.JSONObject;
import com.clusterswisdom.horn.api.ioc.HornAction;
import com.clusterswisdom.horn.api.ioc.HornResponse;
import com.clusterswisdom.horn.api.ioc.api.ApiConfig;
import com.clusterswisdom.horn.api.push.PushDataUtil;
import com.clusterswisdom.horn.api.tmall.TmallInstance;
import com.clusterswisdom.horn.api.tmall.action.AbstractTmallAction;
import com.taobao.api.response.TradeFullinfoGetResponse;

public class PushTradeIdAction extends AbstractTmallAction implements HornAction{
	@Override
	public HornResponse execute(ApiConfig config, JSONObject param)
			throws Exception {
		TradeFullinfoGetResponse response = (TradeFullinfoGetResponse)TmallInstance.getInstance().executeRequest(param, "trade", "tradeFullinfoGet");
		//非电子凭证卷的订单交易完成推送交易完成的订单号到ebiz
		if(!"eticket".equals(response.getTrade().getType())){
			
			PushDataUtil.getUtil().pushData("${pushServer}/tmall/entityProduct/confirmGoods.action", response.getTrade().getTid());
		}
		
		return new HornResponse(true, null);
	}
}
